<template>
    <div class="container buryingConfig" style="width:99%;margin-top:-25px;">
        <!--表格内容栏-->
        <div>
            <Crm-table
                :showOperation="false"
                Answer
                :data="pageResult"
                :columns="columns"
                :loading="loading"
                @findPage="findPage"
                @handleEdit="handleEdit"
                @handleSee='handleSee'
                :order='false'
                permsEdit="answer:answerFile:operation"
                permsExport='answer:answerFile:export'
            ></Crm-table>
        </div>
    </div>
</template>
<script>
import KtButton from "@/views/Core/KtButton";
import CrmTable from "@/views/Core/CrmTable";
import { baseUrl } from "@/utils/global";
import axios from "axios";
import Cookies from "js-cookie";
export default {
    name: "AnswerFile",
    components: {
        CrmTable,
        KtButton
    },
    data() {
        return {
            size: "small",
            loading: false,
            columns: [
                { prop: "id", label: "问卷ID", minWidth: 100 },
                { prop: "title", label: "问卷名称", minWidth: 220 },
                { prop: "scope", label: "适用范围", minWidth: 120 }
            ],
            pageRequest: { pageNum: 1, pageSize: 10 },
            pageResult: {
                content: []
            },
            data: [
                {
                    id: "12556",
                    title: "问卷标题",
                    scope: "适用范围"
                }
            ],
            exportOemUrl:baseUrl+"/questionnaire/exportDetail",
        };
    },
    methods: {
        // 搜索
        search() {
            this.loading = true;
            if (this.value2) {
                this.queryBox.startDate = this.value2[0];
                this.queryBox.endDate = this.value2[1];
            } else {
                this.queryBox.startDate = "";
                this.queryBox.endDate = "";
            }
            this.pageRequest.pageNum = 1;
            this.findPage(null);
        },
        // 获取分页数据
        findPage: function(data) {
            this.loading = true;
            if (data !== null) {
                this.loading = true;
                this.pageRequest = data.pageRequest;
            }

            this.loading = false;
            this.$api.agent.questionnaireSort(this.queryBox).then(res => {
                let content = { content: res.data, totalSize: res.total };
                this.pageResult = content;
                this.loading = false;
            });
        },

        reset(queryBox) {
            this.$refs.queryBox.resetFields();
            this.queryBox.startDate = "";
            this.queryBox.endDate = " ";
            this.queryBox.url = "";
            this.queryBox.bid = "";
            this.queryBox.buryName = "";
            this.queryBox.bName = "";
            this.queryBox.id = "";
            this.queryBox.platform = "";
            this.value2 = "";
            this.findPage(null);
        },
        handleEdit(params) {
            this.$router.push({
                path: "/Answer/AnswerDetails",
                query: {
					id: params.row.id,
					pageName:params.row.title
                }
            });
        },
        handleSee(params){
            let data={}
            data.questionnaireId=params.row.id
                axios({
                    method:'get',
                    url:this.exportOemUrl,
                    params:data
                }).then(res=>{
                    window.open(res.request.responseURL)
                })
        }
    },
    mounted() {}
};
</script>
<style>

</style>
<style lang="scss">
</style>
